package com.qunar.support.dao;

import java.sql.Connection;
import java.sql.PreparedStatement;

import com.qunar.support.util.DBHelper;
import com.qunar.support.util.TimeHelper;

public class LoginLogDao {
	private Connection con;

	/**
	 * 登陆日志insert！
	 * @param uid
	 * @param ip
	 */
	public void logLogin(int uid, String ip) {
		try {
			con = DBHelper.getConnection();
			String insert = "insert into login_log(uid,ip,login_time) values(?,?,?)";
			PreparedStatement pstmt = con.prepareStatement(insert);
			pstmt.setInt(1, uid);
			pstmt.setString(2, ip);
			pstmt.setString(3, TimeHelper.getLogTime());
			pstmt.execute();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
